package com.ling.tools.login;

import com.ling.tools.login.netty.WebSocketServer;
import com.ling.tools.login.netty.WorkThreadPool;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@SpringBootApplication
@EnableSwagger2
public class LoginApplication implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(LoginApplication.class, args);
    }

    WorkThreadPool workThreadPool = new WorkThreadPool();
    public void run(String... args) throws Exception {
        workThreadPool.getPool().execute(() -> {
            try {
                new WebSocketServer().run();
            } catch (Exception e) {
                e.printStackTrace();
            }
        });


    }
}
